<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Reranker Framework (ReFr): reranker::PerceptronModelProtoWriter Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Reranker Framework (ReFr)
   
   </div>
   <div id="projectbrief">Reranking framework for structure prediction and discriminative language modeling</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespacereranker.html">reranker</a>      </li>
      <li class="navelem"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html">PerceptronModelProtoWriter</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">reranker::PerceptronModelProtoWriter Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="reranker::PerceptronModelProtoWriter" --><!-- doxytag: inherits="reranker::ModelProtoWriter" -->
<p>A class to construct a <code>ModelMessage</code> from a <a class="el" href="classreranker_1_1_perceptron_model.html">PerceptronModel</a> instance.  
 <a href="classreranker_1_1_perceptron_model_proto_writer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="perceptron-model-proto-writer_8_h_source.html">perceptron-model-proto-writer.H</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for reranker::PerceptronModelProtoWriter:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classreranker_1_1_perceptron_model_proto_writer.png" usemap="#reranker::PerceptronModelProtoWriter_map" alt=""/>
  <map id="reranker::PerceptronModelProtoWriter_map" name="reranker::PerceptronModelProtoWriter_map">
<area href="classreranker_1_1_model_proto_writer.html" title="A class to construct a ModelMessage from a Model instance." alt="reranker::ModelProtoWriter" shape="rect" coords="0,56,229,80"/>
<area href="classreranker_1_1_factory_constructible.html" title="An interface to make it easier to implement Factory-constructible types by implementing both required..." alt="reranker::FactoryConstructible" shape="rect" coords="0,0,229,24"/>
</map>
 </div></div>

<p><a href="classreranker_1_1_perceptron_model_proto_writer-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#abb9d5226cda407bb550db721ecde5051">PerceptronModelProtoWriter</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new instance that can serialize <a class="el" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> instances to ModelMessage protocol buffer messages.  <a href="#abb9d5226cda407bb550db721ecde5051"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#a03c3e28a447bf3645a46e643d1431f3c">~PerceptronModelProtoWriter</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys this writer.  <a href="#a03c3e28a447bf3645a46e643d1431f3c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#aa0f99ad5ab482cdc7b94d1a093379b59">Write</a> (const <a class="el" href="classreranker_1_1_model.html">Model</a> *model, ModelMessage *model_message, bool write_features) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a <a class="el" href="classreranker_1_1_perceptron_model.html" title="This class implements a perceptron model reranker.">PerceptronModel</a> instance to a ModelMessage.  <a href="#aa0f99ad5ab482cdc7b94d1a093379b59"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#a4368ea895c4b5e3fbbc38610d98d9d36">WriteFeatures</a> (const <a class="el" href="classreranker_1_1_model.html">Model</a> *model, ostream &amp;os, bool output_best_epoch, double weight, bool output_key, const string separator) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes out the features of this model to a series of <code>FeatureMessage</code> instances using the specified <code>ConfusionProtoIO</code> instance.  <a href="#a4368ea895c4b5e3fbbc38610d98d9d36"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A class to construct a <code>ModelMessage</code> from a <a class="el" href="classreranker_1_1_perceptron_model.html">PerceptronModel</a> instance. </p>
<p>TODO(dbikel): Need some kind of a factory for model writers, so the proper <a class="el" href="classreranker_1_1_model_proto_writer.html" title="A class to construct a ModelMessage from a Model instance.">ModelProtoWriter</a> gets instantiated given a particular <a class="el" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> subclass. </p>

<p>Definition at line <a class="el" href="perceptron-model-proto-writer_8_h_source.html#l00058">58</a> of file <a class="el" href="perceptron-model-proto-writer_8_h_source.html">perceptron-model-proto-writer.H</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="abb9d5226cda407bb550db721ecde5051"></a><!-- doxytag: member="reranker::PerceptronModelProtoWriter::PerceptronModelProtoWriter" ref="abb9d5226cda407bb550db721ecde5051" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#abb9d5226cda407bb550db721ecde5051">reranker::PerceptronModelProtoWriter::PerceptronModelProtoWriter</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructs a new instance that can serialize <a class="el" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> instances to ModelMessage protocol buffer messages. </p>

<p>Definition at line <a class="el" href="perceptron-model-proto-writer_8_h_source.html#l00062">62</a> of file <a class="el" href="perceptron-model-proto-writer_8_h_source.html">perceptron-model-proto-writer.H</a>.</p>

</div>
</div>
<a class="anchor" id="a03c3e28a447bf3645a46e643d1431f3c"></a><!-- doxytag: member="reranker::PerceptronModelProtoWriter::~PerceptronModelProtoWriter" ref="a03c3e28a447bf3645a46e643d1431f3c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#a03c3e28a447bf3645a46e643d1431f3c">reranker::PerceptronModelProtoWriter::~PerceptronModelProtoWriter</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destroys this writer. </p>

<p>Definition at line <a class="el" href="perceptron-model-proto-writer_8_h_source.html#l00064">64</a> of file <a class="el" href="perceptron-model-proto-writer_8_h_source.html">perceptron-model-proto-writer.H</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aa0f99ad5ab482cdc7b94d1a093379b59"></a><!-- doxytag: member="reranker::PerceptronModelProtoWriter::Write" ref="aa0f99ad5ab482cdc7b94d1a093379b59" args="(const Model *model, ModelMessage *model_message, bool write_features) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#aa0f99ad5ab482cdc7b94d1a093379b59">reranker::PerceptronModelProtoWriter::Write</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classreranker_1_1_model.html">Model</a> *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ModelMessage *&#160;</td>
          <td class="paramname"><em>model_message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>write_features</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Serializes a <a class="el" href="classreranker_1_1_perceptron_model.html" title="This class implements a perceptron model reranker.">PerceptronModel</a> instance to a ModelMessage. </p>
<p>When the <code>write_features</code> parameter is <code>true</code>, the feature vectors written out will be those of the best model epoch (typically the epoch with the lowest average devtest loss).</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">model</td><td>the <a class="el" href="classreranker_1_1_perceptron_model.html">PerceptronModel</a> to be serialized to the specified <code>ModelMessage</code> </td></tr>
    <tr><td class="paramname">model_message</td><td>the ModelMessage to be filled in by this method with the serialized version of the specified <a class="el" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> </td></tr>
    <tr><td class="paramname">write_features</td><td>whether the features of the specified <a class="el" href="classreranker_1_1_model.html">Model</a> should be written out </td></tr>
  </table>
  </dd>
</dl>

<p>Implements <a class="el" href="classreranker_1_1_model_proto_writer.html#a8d53e498fb3c11c13de332b483264c5a">reranker::ModelProtoWriter</a>.</p>

<p>Definition at line <a class="el" href="perceptron-model-proto-writer_8_c_source.html#l00052">52</a> of file <a class="el" href="perceptron-model-proto-writer_8_c_source.html">perceptron-model-proto-writer.C</a>.</p>

</div>
</div>
<a class="anchor" id="a4368ea895c4b5e3fbbc38610d98d9d36"></a><!-- doxytag: member="reranker::PerceptronModelProtoWriter::WriteFeatures" ref="a4368ea895c4b5e3fbbc38610d98d9d36" args="(const Model *model, ostream &amp;os, bool output_best_epoch, double weight, bool output_key, const string separator) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#a4368ea895c4b5e3fbbc38610d98d9d36">reranker::PerceptronModelProtoWriter::WriteFeatures</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classreranker_1_1_model.html">Model</a> *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ostream &amp;&#160;</td>
          <td class="paramname"><em>os</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>output_best_epoch</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>weight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>output_key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string&#160;</td>
          <td class="paramname"><em>separator</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Writes out the features of this model to a series of <code>FeatureMessage</code> instances using the specified <code>ConfusionProtoIO</code> instance. </p>
<p>This method writes out both the raw feature values as well as the averaged values; however, the averaged values are stored in the avg_value field of the FeatureMessage object. In contrast to the behavior of the <a class="el" href="classreranker_1_1_perceptron_model_proto_writer.html#aa0f99ad5ab482cdc7b94d1a093379b59">Write</a> method, the features written out by this method will be those of the current model, as opposed to those of the best model.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">model</td><td>the <a class="el" href="classreranker_1_1_perceptron_model.html">PerceptronModel</a> to be serialized to the specified <code>ModelMessage</code> </td></tr>
    <tr><td class="paramname">os</td><td>the output stream to which to write features </td></tr>
    <tr><td class="paramname">output_best_epoch</td><td>output the weights of the best epoch of training, as opposed to the most recent epoch </td></tr>
    <tr><td class="paramname">weight</td><td>the weight by which all feature weights should be multiplied before being output </td></tr>
    <tr><td class="paramname">output_key</td><td>output the key (feature name) and separator for each feature </td></tr>
    <tr><td class="paramname">separator</td><td>the separator string to output between each feature&rsquo;s key and its base64-encoded <code>FeatureMessage</code> (only used if output_key == True) </td></tr>
  </table>
  </dd>
</dl>

<p>Implements <a class="el" href="classreranker_1_1_model_proto_writer.html#a36b26c1a4350412fdd66d0aadb56e273">reranker::ModelProtoWriter</a>.</p>

<p>Definition at line <a class="el" href="perceptron-model-proto-writer_8_c_source.html#l00095">95</a> of file <a class="el" href="perceptron-model-proto-writer_8_c_source.html">perceptron-model-proto-writer.C</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="perceptron-model-proto-writer_8_h_source.html">perceptron-model-proto-writer.H</a></li>
<li><a class="el" href="perceptron-model-proto-writer_8_c_source.html">perceptron-model-proto-writer.C</a></li>
</ul>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Apr 9 2013 11:56:31 for Reranker Framework (ReFr) by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
